<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>严格模式声明3</title>
</head>

<body>
    <p>在函数内使用 "use strict" 只在函数内报错。</p>
    <p>浏览器按下 F12 开启调试模式，查看报错信息。</p>
    <script>
        x = 3.14;     // 不报错 
        myFunction()
        function myFunction() {
            "use strict";
            y = 3.14;   // 报错 (y 未定义)
        }
    </script>
</body>

</html>